<?php

class ZA_Form_Element_Reqnumber extends Zend_Form_Element_Xhtml {
    
    public $helper = 'reqnumberElement';
    protected $reqnum = null;
    protected $deptcode = null;
    protected $month = null;
    protected $year = null;


    function setReqnum($num)
    {
        $this->reqnum = $num;
        return $this;
    }
    
    function setDeptcode($num)
    {
        $this->deptcode = $num;
        return $this;
    }
    
    function setMonth($num)
    {
        $this->month = $num;
        return $this;
    }
    
    function setYear($num)
    {
        $this->year = $num;
        return $this;
    }
    
    public function setValue($value)
    {
        if(is_array($value) && isset($value['reqnum']) && isset($value['deptcode']) 
                && isset($value['month']) && isset($value['year']))
        {
            $this->setReqnum($value['reqnum'])
                 ->setDeptcode($value['deptcode'])
                 ->setMonth($value['month'])
                 ->setYear($value['year']);
        }
    }
    
    public function getValue() {
        if(! $this->reqnum || ! $this->deptcode || ! $this->month || ! $this->year)
        {
            return false;
        }
        
        return $this->reqnum.'/'.$this->deptcode.'/'.$this->month.'/'.$this->year;
    }
}
